<?php

namespace App\Http\Controllers\Chat\User;

use App\Http\Requests\Chat\User\ChatUserRequest;
use App\Services\Chat\User\ChatUserService;
use App\Http\Controllers\AdminBaseController;
use App\Util\LoginUtil;
use Illuminate\Auth\Events\Login;
use Illuminate\Support\Facades\Request;

class ChatUserController extends AdminBaseController
{
    protected $services = null;

    public function __construct(ChatUserService $services, ChatUserRequest $request)
    {
        parent::__construct();

        $this->services = $services;
        $this->request = $request;
    }

    // 获取本人信息
    public function userInfo($id)
    {
        $res = $this->services->userInfo($id);
        return $this->success($res);
    }
    // 更改本人信息
    public function updateUserInfo()
    {
        $res = $this->services->updateUserInfo();
        return $this->success($res);
    }

    // 获取用户好友列表
    public function friends()
    {
        $res = $this->services->friends();
        return $this->success($res);
    }

    // 获取用户好友分组列表
    public function groupFriends()
    {
        $res = $this->services->groupFriends();
        return $this->success($res);
    }

    // 更改分组名
    public function updateGroupName()
    {
        $res = $this->services->updateGroupName();
        return $this->success($res);
    }

    // 更改备注
    public function updateRemark()
    {
        $res = $this->services->updateRemark();
        return $this->success($res);
    }

    // 获取用户好友列表
    public function searchFriend()
    {
        $res = $this->services->searchFriend();
        return $this->success($res);
    }

    // 申请添加好友
    public function addFriend()
    {
        $res = $this->services->addFriend();
        return $this->success($res);
    }

    // 好友请求列表
    public function friendApplyList()
    {
        $res = $this->services->friendApplyList();
        return $this->success($res);
    }

    // 待处理好友数量
    public function newFriendNum()
    {
        $res = $this->services->newFriendNum();
        return $this->success($res);
    }

    // 获取添加人详情
    public function getNewFriend()
    {
        $res = $this->services->getNewFriend();
        return $this->success($res);
    }

    // 同意好友申请
    public function agreeNewFriend()
    {
        $res = $this->services->agreeNewFriend();
        return $this->success($res);
    }

    // 绑定client_id
    public function bindClientId()
    {
        $res = $this->services->bindClientId();
        return $this->success($res);
    }

    // 客户端发送消息
    public function sendMsg()
    {
        $res = $this->services->sendMsg();
        return $this->success($res);
    }

    // 历史消息
    public function msgHistory()
    {
        $res = $this->services->msgHistory();
        return $this->success($res);
    }

    // 用户断开ws连接
    public function userLogout()
    {
        $res = $this->services->userLogout();
        return $this->success($res);
    }

    // 用户进入房间
    public function comingOrLeaveGroup()
    {
        $res = $this->services->comingOrLeaveGroup();
        return $this->success($res);
    }

}
